package com.example.teesystem.mapper;

import com.example.teesystem.entity.BoatRank;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

/**
* @author 12510
* @description 针对表【t_boat_rank】的数据库操作Mapper
* @createDate 2022-11-26 12:48:03
* @Entity com.example.teesystem.entity.BoatRank
*/
@Mapper
public interface BoatRankMapper extends BaseMapper<BoatRank> {
    @Select("select * from t_boat_rank where course_id = #{courseId} and uid = #{uid}")
    BoatRank getBoatRankByCourseId(int uid,int courseId);
    @Update("update t_boat_rank set score=#{score},win_num = #{winNum} where course_id = #{courseId} and uid = #{uid}")
    void updateScore(int score,int winNum,int uid,int courseId);
    @Select("select * from t_boat_rank  where course_id = #{courseId} order by score desc limit 50")
    List<BoatRank> getRank(int courseId);
    @Update("update t_boat_rank set win_num = #{winNum},score = #{score},update_time=#{updateTime} where id = #{id}")
    void updateById(int id, int winNum, int score, Date updateTime);
}




